from matplotlib import pyplot as plt
import numpy as np

name_list=['chinese','math','english']
class1=[81.4,83,87.1]
class2=[85.6,87.4,90]
class3=[78,81.2,86.1]
width=0.4
x=np.array([1,3,5])
plt.bar(x,class1,label='class 1',fc='r',width=width)
plt.bar(x+width,class2,label='class 2',fc='g',width=width)
plt.bar(x+width*2,class3,label='class 3',fc='b',width=width)
plt.xticks(x+width,name_list)
plt.legend()
plt.title('Three classes Scores')
plt.xlabel('Subject')
plt.ylabel('Score')
plt.show()
